﻿@model IEnumerable<MyNeighbourhood.Models.EventModel>
@using MyNeighbourhood.Helpers;

@{
    ViewBag.Title = "Index";
}

<link href="~/Content/Events.css" rel="stylesheet" />
<script src="~/Scripts/jquery-1.8.2.min.js"></script>

<div id="event-index">
    <h2 class="title">All Events</h2>

    <h2>
        <a href="@Url.Action("Create", "Events")" title="Add Event">
            <img src="~/Images/custom/linedpaperplus32.png" />
        </a>
    </h2>

    <table id="events-table">
        <colgroup>
            <col span="1" style="width: 12.5%;">
            <col span="1" style="width: 12.5%;">
        </colgroup>


        @if (Model != null)
        {
            foreach (var item in Model)
            {
            <tr>
                <td id="header">
                    @Html.DisplayFor(modelItem => item.Name)
                </td>
                <td id="actions">
                    <a href="@Url.Action("Edit", "Events", new { id = item.EventId })" title="Edit Event">
                        <img src="~/Images/custom/pencil32.png" />
                    </a>
                    <a href="@Url.Action("Delete", "Events", new { id = item.EventId })" title="Delete Event">
                        <img src="~/Images/custom/recycle32.png" />
                    </a>
                    @*@Html.ActionLink("Промени", "Edit", "Events", new { id = item.EventId }, new { style = "color:blue" }) |
            @Html.ActionLink("Изтрий", "Delete", new { id = item.EventId })*@
                    @Ajax.ActionImageLink("../Images/custom/linedpaper32.png", "View Details", "Details", "Events",
                new { id = item.EventId },
                new AjaxOptions { HttpMethod = "get", UpdateTargetId = "event-details", InsertionMode = InsertionMode.Replace, OnSuccess = "showDetailsDiv()" })
                </td>
            </tr>
            }
        }

    </table>

    <div id="event-details">
    </div>
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}